/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.demo;

import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author WRCASTRO
 */
public class CustomerHelper {

    Session session = null;

    public CustomerHelper() {
        this.session = HibernateUtil.getSessionFactory().getCurrentSession();
    }

    public List getCustomers() {
    List<Customer> filmList = null;
    try {
        org.hibernate.Transaction tx = session.beginTransaction();
        Query q = session.createQuery ("from com.demo.Customer");
        filmList = (List<Customer>) q.list();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return filmList;
}

}
